package com.example.prison.config;

public class Restful<T> {
    private Integer code;
    private String message;
    private T data;

    public Restful(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Restful(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> Restful<T> success(String message) {
        return new Restful<>(0, message);
    }

    public static <T> Restful<T> error(String message) {
        return new Restful<>(-1, message);
    }

    public static <T> Restful<T> info(String message) {
        return new Restful<>(1, message);
    }

    public static <T> Restful<T> success(String message, T data) {
        return new Restful<>(0, message, data);
    }
}
